<?php

class Provincias_model extends CI_Model
{

    private $table = "provincias";

    function __construct()
    {
        parent::__construct();
    }

    function insert($row = array())
    {
        $this->db->insert($this->table, $row);
        return $this->db->insert_id();
    }

    function update($id, $row = array())
    {
        $this->db->where("id", $id);
        $this->db->update($this->table, $row);
    }

    function find($id)
    {
        $this->db->where('id', $id);
        $rows = $this->db->get($this->table);
        return $rows;
    }

    function list_all()
    {
        return $this->db->get($this->table);
    }

    function delete($id)
    {
        $this->db->where('id', $id);
        $this->db->delete($this->table);
    }

    function count()
    {
        return $this->db->count_all($this->table);
    }

    function list_all_limit($start, $end)
    {
        $this->db->select('*');
        $this->db->limit($end, $start);
        $this->db->order_by('id', 'desc');
        return $this->db->get($this->table);
    }

}

?>